import { createWebHashHistory,createRouter } from 'vue-router'

import Layout from "../pages/Main.vue"
import Home from"../pages/home/index.vue"
import Order from"../pages/order/index.vue"
import User from "../pages/user/index.vue"
import Login from "../pages/login/index.vue"
import createOrder from "../pages/createorder/index.vue"
import Detail from "../pages/detail/index.vue"

const routes = [
    {
        path: '/',
        component: Layout,
        redirect:'home',
        children:[
            {
                path: 'home',
                meta:{
                    icon:'home-o',
                    name:'home',
                },
                component: Home,
            },
            {
                path: 'order',
                meta:{
                    icon:'orders-o',
                    name:'订单',
                },
                component: Order,
            },
            {
                path: 'user',
                meta:{
                    icon:'user-circle-o',
                    name:'我的',
                },
                component: User,
            },
        ], 
    },
    { path: '/createOrder', name:'createOrder', component: createOrder,},
    {path: '/login',name:'login',component:Login},
    {path: '/detail',name:'detail',component:Detail},
]

const router = createRouter({
    history: createWebHashHistory(),
    routes,
  })

export default router